/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.supplier.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.A000;
import queenb.net.entitybean.V220;
import queenb.web.store.A000Store;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class V220Store extends V220 {

    // Hamf laay combobox cua dichj vu
    public List<V220> findAllV220Combo(int pnFH000, int pnFH200, int pnFA000, int pnFK100, int pnFV220, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_V200_COMBO, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFA000),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.INTEGER, pnFV220),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    // Hàm lấy giá dịch vụ từ tỉnh thành nhà cung cấp, dịch vụ
    public List<V220> findAllV220ForPrice(int pnFH000, int pnFH200, int pnFA000, int pnFK100, int pnFV220, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_A000_country_service_price, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFA000),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.INTEGER, pnFV220),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    // Hamf lay nha cung cap tu dich vu va tinh thanh

    public List<V220> findAllV220Forsupplier(int pnFH000, int pnFH200, int pnFV220, int pnFV200, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_A000_country_service, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFV220),
                        new Param(OracleTypes.INTEGER, pnFV200),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    // Hamf lay nha cung cap tu dich vu va tinh thanh va nha cung cap
    public List<V220> findAllV220Forsupplierandservice(int pnFH000, int pnFH200, int pnFV200, int pnFA000, int pnPK100, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.COMBO_A000_country_service1, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFV200),
                        new Param(OracleTypes.INTEGER, pnFA000),
                        new Param(OracleTypes.INTEGER, pnPK100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(dataStatement, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public List<V220> getListS350All(int pnFH000, int pnFH200, int pnFS350, int pnFS200, int pnFV220, int pnFN750, int pnFK100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_S350, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFS350),
                        new Param(OracleTypes.INTEGER, pnFS200),
                        new Param(OracleTypes.INTEGER, pnFV220),
                        new Param(OracleTypes.INTEGER, pnFN750),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public int updateV220(int pnPV220, int pnFH000, int pnFH200, int pnFK100, int pnFA000, int pnFV200, Date pdVD221, Date pdVD222, String pvVV223, int pnVN224, String pvVV225, String pvVV226, String pvVV227, double pnVN228, String pvLOGIN) {
        DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_V220, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPV220),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFK100),
                    new Param(OracleTypes.INTEGER, pnFA000),
                    new Param(OracleTypes.INTEGER, pnFV200),
                    new Param(OracleTypes.DATE, pdVD221),
                    new Param(OracleTypes.DATE, pdVD222),
                    new Param(OracleTypes.CHAR, pvVV223),
                    new Param(OracleTypes.INTEGER, pnVN224),
                    new Param(OracleTypes.CHAR, pvVV225),
                    new Param(OracleTypes.CHAR, pvVV226),
                    new Param(OracleTypes.CHAR, pvVV227),
                    new Param(OracleTypes.DOUBLE, pnVN228),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    // dịch vu của nhà cung cấp

    public List<V220> getListV220All(int pnFH000, int pnFH200, int pnFV220, int pnFV200, int pnFA000, int pnFN750, int pnFK100, String pvLOGIN) {
        try {
            DataStatement data = new DataStatement(PackageContants.LIST_V220, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                        new Param(OracleTypes.INTEGER, pnFV220),
                        new Param(OracleTypes.INTEGER, pnFV200),
                        new Param(OracleTypes.INTEGER, pnFA000),
                        new Param(OracleTypes.INTEGER, pnFN750),
                        new Param(OracleTypes.INTEGER, pnFK100),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.find(data, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public int deleteV220(int pnPv220, String pvLOGIN) {
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_V220, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPv220),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, V220.class);
        } catch (SQLException ex) {
            Logger.getLogger(V220Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }

    }

    
}
